import uuid from '../../utils/uuid';

Page({
  data: {
    priceFilter: [
      {
        key: uuid(),
        scope: [0]
      },
      {
        key: uuid(),
        scope: [1, 100]
      },
      {
        key: uuid(),
        scope: [100, 500]
      },
      {
        key: uuid(),
        scope: [500, 5000]
      },
      {
        key: uuid(),
        scope: [5000]
      }
    ],
    activeKey: '',
    activeFilter: [],
  },
  onLoad() {
    this.data.activeKey = this.data.priceFilter[0].key;
    this.data.activeFilter = this.data.priceFilter[0].scope;
  },
  activeTab(e) {
    const { item } = e.target.dataset;
    this.setData({
      activeKey: item.key,
      activeFilter: item.scope
    })

  },
  goHome() {
    my.navigateTo({
      url: '/pages/home/home'
    })
  }
});
